import { requestLogin } from "@/network/login/index";
import {defineStore} from "pinia";


// 用户状态管理
const useUserStore = defineStore('userstore',{
    state:()=>({
        token: "",
        userInfo: {}
        
    }),
    getters:{

    },
    actions:{
        Login(userInfo:userInfoterface){
            let username = userInfo.username
            let password = userInfo.password
            return new Promise((resolve,reject)=>{
                requestLogin({username,password}).then((res)=>{
                    resolve(true)
                }).catch(err=>{
                    reject(false)
                })
            })
        }
    }
})

export default useUserStore;